/**
 * Baco OPC - Baco Sistemas corp.
 */

/*
 * GUI.java
 *
 * Created on 04/12/2009, 13:58:06
 */
package bacoopc.gui;

import bacoopc.AlgoritmoDeControle;
import bacoopc.BacoOPC;
import bacoopc.excecoes.ExcecaoBacoOpc;
import bacoopc.gui.entidades.AlgoritmoInterface;
import bacoopc.gui.entidades.ProjetoInterface;
import bacoopc.gui.entidades.ServidorInterface;
import bacoopc.persistencia.PersistenciaAlgoritmo;
import bacoopc.persistencia.PersistenciaProjeto;
import bacoopc.persistencia.PersistenciaServidorOPC;
import java.awt.CardLayout;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;

/**
 *
 * @author  Baco Sistemas
 */
public class GUI extends javax.swing.JFrame {

    // TODO excluir projeto
    // TODO modificar projeto
    // TODO excluir algoritmo
    // TODO cadastrar algoritmo
    // TODO rodar projeto
    // TODO excluir servidor
    // TODO colocar botão de cancelar no panel de criar projeto

    /** Creates new form GUI */
    public GUI() {
        initComponents();

        // Inicializa as árvores
        this.atualizarArvores();
        OuvinteArvoreProjetos ouvinteArvores = new OuvinteArvoreProjetos() ;
        ouvinteArvores.interfaceUtilizada = this ;
        this.arvoreAlgoritmos.addTreeSelectionListener(ouvinteArvores);
        this.arvoreProjetos.addTreeSelectionListener(ouvinteArvores);
        this.arvoreServidores.addTreeSelectionListener(ouvinteArvores);

    }

    protected void atualizarArvores() {
        this.arvoreProjetos = new JTree(atualizarArvoreProjetos().getModel());
        this.scrollProjetos.setViewportView(this.arvoreProjetos);
        this.arvoreServidores = new JTree(this.atualizarArvoreServidores().getModel());
        this.scrollArvoresServidores.setViewportView(this.arvoreServidores);
        this.arvoreAlgoritmos = new JTree( this.atualizarArvoreAlgoritmos().getModel() );
        this.scrollAlgoritmos.setViewportView(this.arvoreAlgoritmos);
    }

    /**
     * Inicializa a árvore de projetos
     */
    protected JTree atualizarArvoreProjetos() {
        JTree result = null;
        try {
            // TODO colocar essas operações em BAcoOPC
            DefaultMutableTreeNode node = new DefaultMutableTreeNode("Projetos");
            DefaultMutableTreeNode nodeTemp = null;
            List<ProjetoInterface> projetos = BacoOPC.getInstance().listarProjetos();
            for (ProjetoInterface proj : projetos) {
                node.add(new DefaultMutableTreeNode(proj));
            }
            result = new JTree(node);
        } catch (ExcecaoBacoOpc ex) {

            // TODO tratar essa exceção
            Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        return result ;
    }

    /**
     * Inicializa a árvore de projetos
     */
    protected JTree atualizarArvoreServidores() {

        // TODO essa operação em BacoOpc
        PersistenciaServidorOPC pa = new PersistenciaServidorOPC();
        ResultSet rs = pa.consultarServidores();
        DefaultMutableTreeNode node = new DefaultMutableTreeNode("Servidores");
        DefaultMutableTreeNode nodeTemp = null ;

        try {
            while (rs.next()) {
                String st1 = rs.getString("nome");
                nodeTemp = new DefaultMutableTreeNode(st1);
                node.add(nodeTemp);
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return new JTree(node);
    }

    protected JTree atualizarArvoreAlgoritmos() {
        // TODO colocar essa operação em BacoOpc
        PersistenciaAlgoritmo pa = new PersistenciaAlgoritmo();
        ResultSet rs = pa.consultarAlgoritmos();
        DefaultMutableTreeNode node = new DefaultMutableTreeNode("Algoritmos");
        DefaultMutableTreeNode nodeTemp = null ;

        try {
            while (rs.next()) {
                String st1 = rs.getString("nome");
                nodeTemp = new DefaultMutableTreeNode(st1);
                node.add(nodeTemp);
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return new JTree(node);
    }

    /**
     * Inicializa a árvore de projetos
     */
    protected void inicializarArvoreServidores() {
        TreeNode root = new DefaultMutableTreeNode("Projetos");
        DefaultTreeModel model = new DefaultTreeModel(root);
    }

    /**
     * Método auxiliar para mostrar o painel do card layout
     * responsável pelo cadastro de projetos
     */
    protected void mostrarPainelCadastrarProjetos() {
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card1");
    }

    /**
     * Método auxiliar para mostrar o paine do card layout responsável
     * pelo cadastro de servidores
     */
    protected void mostrarPainelCadastrarServidores() {

    }

    /**
     * Método auxiliar para mostrar o painel do cardc
     */
    protected void mostrarPainelCadastrarAlgoritmo() {

    }

    /**
     *
     */
    protected void mostrarPainelProjeto( ProjetoInterface proj ) {
        CardLayout cl = (CardLayout) painelPrincipal.getLayout() ;
        cl.show(this.painelPrincipal, "card9");

        this.painelProjetoNomeProjeto.setText( proj.getNome() );
        this.painelProjetoAutor.setText(proj.getAutor());

        // TODO colocar a data no formato brasileiro
        this.painelProjetoDataCriacao.setText( proj.getDataCriacao().toString() );



    }

    protected void mostrarPainel( Object obNode ) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode)obNode ;
        Object objeto = node.getUserObject() ;
        if ( objeto instanceof ProjetoInterface ) {
            this.mostrarPainelProjeto( (ProjetoInterface) objeto ) ;
        } else if ( objeto instanceof ServidorInterface ) {
            // TODO mostrar painel do servidor OPC
        } else if (objeto instanceof AlgoritmoInterface ) {
            // TODO mostrar painel do Algoritmo
        }
    }

    /**
     * Utilizando quando o usuario seleciona um projeto na árvore de
     * projetos
     *
     * @return O projeto selecionado na árvore de projetos
     */
    protected Object getSelecao() {
        Object result = this.arvoreAlgoritmos.getLastSelectedPathComponent() ;
        result = result == null ? this.arvoreProjetos.getLastSelectedPathComponent() : result ;
        result = result == null ? this.arvoreServidores.getLastSelectedPathComponent() : result ;
        return result ;
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        painelPrincipal = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        labelCriarNovoProjetoTelaInicial = new javax.swing.JLabel();
        labelCadastrarServidorOpcTelaInicial = new javax.swing.JLabel();
        labelCadastrraAlgoritmoTelaInicial = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        cadastrarProjetoNomeAutor = new javax.swing.JTextField();
        cadastrarProjetoNomeProjeto = new javax.swing.JTextField();
        jSeparator3 = new javax.swing.JSeparator();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        servidorOpcNomeServidor = new javax.swing.JTextField();
        servidorOpcUrl = new javax.swing.JTextField();
        cadastroServidorOpcCriar = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        painelProjeto = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        painelProjetoNomeProjeto = new javax.swing.JTextField();
        painelProjetoAutor = new javax.swing.JTextField();
        painelProjetoDataCriacao = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        painelProjetoListaServidores = new javax.swing.JList();
        jSeparator5 = new javax.swing.JSeparator();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        painelProjetoListaAlgoritmos = new javax.swing.JList();
        jLabel21 = new javax.swing.JLabel();
        painelProjetosAlgoritmos = new javax.swing.JButton();
        painelProjetosBotalGerenciarServidores = new javax.swing.JButton();
        jSeparator6 = new javax.swing.JSeparator();
        painelProjetoBotaoAutomaticoManual = new javax.swing.JToggleButton();
        jLabel22 = new javax.swing.JLabel();
        painelProjetoCaixaAbertura = new javax.swing.JSpinner();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        painelProjetoCaixaLog = new javax.swing.JTextArea();
        jLabel24 = new javax.swing.JLabel();
        painelProjetoCaixaNivel = new javax.swing.JTextField();
        jToggleButton2 = new javax.swing.JToggleButton();
        bacoPainelTabulado = new javax.swing.JTabbedPane();
        scrollAlgoritmos = new javax.swing.JScrollPane();
        arvoreAlgoritmos = new javax.swing.JTree();
        scrollProjetos = new javax.swing.JScrollPane();
        arvoreProjetos = new javax.swing.JTree();
        scrollArvoresServidores = new javax.swing.JScrollPane();
        arvoreServidores = new javax.swing.JTree();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        itemMenuCriarProjeto = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        itemMenuCadastrarServidor = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        itemMenuCadastrarAlgoritmo = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator4 = new javax.swing.JSeparator();
        jMenuItem9 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Baco OPC v 0.1");
        setResizable(false);

        jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 255), 1, true));

        painelPrincipal.setBackground(new java.awt.Color(204, 204, 255));
        painelPrincipal.setLayout(new java.awt.CardLayout());

        jLabel13.setText("Baco OPC v1.0");

        jLabel15.setText("Ações");

        labelCriarNovoProjetoTelaInicial.setText("Criar novo Projeto");
        labelCriarNovoProjetoTelaInicial.setAutoscrolls(true);
        labelCriarNovoProjetoTelaInicial.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                labelCriarNovoProjetoTelaInicialMouseReleased(evt);
            }
        });
        labelCriarNovoProjetoTelaInicial.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                labelCriarNovoProjetoTelaInicialKeyReleased(evt);
            }
        });

        labelCadastrarServidorOpcTelaInicial.setText("Cadastrar Servidor OPC");
        labelCadastrarServidorOpcTelaInicial.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                labelCadastrarServidorOpcTelaInicialMouseReleased(evt);
            }
        });

        labelCadastrraAlgoritmoTelaInicial.setText("Cadastrar Algoritmo de Controle");
        labelCadastrraAlgoritmoTelaInicial.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                labelCadastrraAlgoritmoTelaInicialMouseReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(jLabel15)))
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelCriarNovoProjetoTelaInicial)
                            .addComponent(labelCadastrarServidorOpcTelaInicial)
                            .addComponent(labelCadastrraAlgoritmoTelaInicial))))
                .addContainerGap(279, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addGap(18, 18, 18)
                .addComponent(jLabel15)
                .addGap(18, 18, 18)
                .addComponent(labelCriarNovoProjetoTelaInicial)
                .addGap(11, 11, 11)
                .addComponent(labelCadastrarServidorOpcTelaInicial)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelCadastrraAlgoritmoTelaInicial)
                .addContainerGap(302, Short.MAX_VALUE))
        );

        painelPrincipal.add(jPanel10, "card10");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 153), new java.awt.Color(204, 204, 255)), "Novo Projeto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        jLabel1.setText("Nome do Projeto :");

        jLabel11.setText("Autor:");

        jButton4.setText("Criar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        cadastrarProjetoNomeAutor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarProjetoNomeAutorActionPerformed(evt);
            }
        });

        cadastrarProjetoNomeProjeto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrarProjetoNomeProjetoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cadastrarProjetoNomeProjeto, javax.swing.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cadastrarProjetoNomeAutor, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE))
                    .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE)
                    .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(cadastrarProjetoNomeProjeto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(cadastrarProjetoNomeAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4)
                .addGap(317, 317, 317))
        );

        painelPrincipal.add(jPanel1, "card1");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 153), new java.awt.Color(204, 204, 255)), "Servidor OPC", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        jLabel2.setText("Nome do Servidor:");

        jLabel12.setText("URL:");

        servidorOpcNomeServidor.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 102), new java.awt.Color(204, 204, 255)));
        servidorOpcNomeServidor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                servidorOpcNomeServidorActionPerformed(evt);
            }
        });

        servidorOpcUrl.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 102), new java.awt.Color(204, 204, 255)));

        cadastroServidorOpcCriar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/run.png"))); // NOI18N
        cadastroServidorOpcCriar.setText("Criar");
        cadastroServidorOpcCriar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroServidorOpcCriarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel12))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(servidorOpcUrl, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
                            .addComponent(servidorOpcNomeServidor, javax.swing.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)))
                    .addComponent(cadastroServidorOpcCriar))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(servidorOpcNomeServidor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(servidorOpcUrl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addGap(18, 18, 18)
                .addComponent(cadastroServidorOpcCriar)
                .addContainerGap(311, Short.MAX_VALUE))
        );

        painelPrincipal.add(jPanel3, "card3");

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 153), new java.awt.Color(204, 204, 255)), "Excluir Servidor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 451, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 415, Short.MAX_VALUE)
        );

        painelPrincipal.add(jPanel6, "card6");

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 102), new java.awt.Color(204, 204, 255)), "Créditos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel3.setForeground(new java.awt.Color(0, 0, 102));
        jLabel3.setText("Equipe Desenvolvedora Baco Sys");

        jLabel4.setForeground(new java.awt.Color(0, 0, 102));
        jLabel4.setText("<html>\n<b>Bráulio Bezerra da Silva</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i>\n\n\n\n</html>");

        jLabel5.setForeground(new java.awt.Color(0, 0, 102));
        jLabel5.setText("<html>\n<b>Caroline Albuquerque Dantas Silva</b><br/><i> Graduanda do Curso de Engenharia de Computação - UFRN</i><br/><i> Tecnóloga em Desenvolvimento de Software - IFRN</i>\n\n\n\n</html>");

        jLabel6.setForeground(new java.awt.Color(0, 0, 102));
        jLabel6.setText("<html>\n<b>Cristiano Gurgel de Castro</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i><br/><i> Técnico em Manutenção de Equipamentos de Informática pelo CEFET-RN</i>\n\n\n\n</html>");

        jLabel7.setForeground(new java.awt.Color(0, 0, 102));
        jLabel7.setText("<html> <b>Engel Faustino Silva</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i><br/> </html>");

        jLabel8.setForeground(new java.awt.Color(0, 0, 102));
        jLabel8.setText("<html> <b>Iur Guerrai</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i><br/> </html>");

        jLabel9.setForeground(new java.awt.Color(0, 0, 102));
        jLabel9.setText("<html> <b>Rebecca Betwel Santos</b><br/><i> Graduanda do Curso de Engenharia de Computação - UFRN</i><br/><i>WebDesing - SENAC/RN</i> </html>");

        jLabel10.setForeground(new java.awt.Color(0, 0, 102));
        jLabel10.setText("<html> <b>Vicente Fidelis</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i><br/> </html>");

        jLabel16.setText("<html><small><i>Obrigado por usar nossos produtos.</i></small></html>");

        jLabel14.setForeground(new java.awt.Color(0, 0, 102));
        jLabel14.setText("<html> <b>João Wagner Chaves Costa</b><br/><i> Graduando do Curso de Engenharia de Computação - UFRN</i><br/> </html>");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addContainerGap(90, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(214, Short.MAX_VALUE)
                .addComponent(jLabel3)
                .addContainerGap())
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel10)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel14)
                .addContainerGap(152, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel16)
                .addContainerGap(277, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel8)
                .addContainerGap(152, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jLabel4)
                .addGap(18, 18, 18)
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addComponent(jLabel7)
                .addGap(18, 18, 18)
                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel9)
                .addGap(14, 14, 14)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel16))
        );

        painelPrincipal.add(jPanel4, "card4");

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 153), new java.awt.Color(204, 204, 255)), "Help", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 451, Short.MAX_VALUE)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 415, Short.MAX_VALUE)
        );

        painelPrincipal.add(jPanel7, "card7");

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 153), new java.awt.Color(204, 204, 255)), "Alterar Servidor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 153))); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 451, Short.MAX_VALUE)
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 415, Short.MAX_VALUE)
        );

        painelPrincipal.add(jPanel9, "card9");

        painelProjeto.setBorder(javax.swing.BorderFactory.createTitledBorder("Projeto"));

        jLabel17.setText("Nome Projeto:");

        jLabel18.setText("Autor:");

        jLabel19.setText("Data Criação");

        painelProjetoNomeProjeto.setText("jTextField1");
        painelProjetoNomeProjeto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                painelProjetoNomeProjetoActionPerformed(evt);
            }
        });

        painelProjetoAutor.setText("jTextField2");

        painelProjetoDataCriacao.setText("jTextField3");

        painelProjetoListaServidores.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(painelProjetoListaServidores);

        jLabel20.setText("Servidores cadastrados:");

        painelProjetoListaAlgoritmos.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(painelProjetoListaAlgoritmos);

        jLabel21.setText("Algoritmos cadastrados:");

        painelProjetosAlgoritmos.setText("Gerenciar");
        painelProjetosAlgoritmos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                painelProjetosAlgoritmosActionPerformed(evt);
            }
        });

        painelProjetosBotalGerenciarServidores.setText("Gerenciar");
        painelProjetosBotalGerenciarServidores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                painelProjetosBotalGerenciarServidoresActionPerformed(evt);
            }
        });

        painelProjetoBotaoAutomaticoManual.setText("Mudar para Automático");
        painelProjetoBotaoAutomaticoManual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                painelProjetoBotaoAutomaticoManualActionPerformed(evt);
            }
        });

        jLabel22.setText("Abertura Válvula:");

        painelProjetoCaixaAbertura.setToolTipText("Porcentagem de abertura da válvula");

        jLabel23.setText("Nível:");

        painelProjetoCaixaLog.setColumns(20);
        painelProjetoCaixaLog.setRows(5);
        jScrollPane3.setViewportView(painelProjetoCaixaLog);

        jLabel24.setText("Log:");

        painelProjetoCaixaNivel.setText("jTextField4");

        jToggleButton2.setText("Rodar");
        jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout painelProjetoLayout = new javax.swing.GroupLayout(painelProjeto);
        painelProjeto.setLayout(painelProjetoLayout);
        painelProjetoLayout.setHorizontalGroup(
            painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelProjetoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator6, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, painelProjetoLayout.createSequentialGroup()
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel18)
                            .addComponent(jLabel19))
                        .addGap(37, 37, 37)
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(painelProjetoDataCriacao, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
                            .addComponent(painelProjetoAutor, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
                            .addComponent(painelProjetoNomeProjeto, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)))
                    .addComponent(jSeparator5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, painelProjetoLayout.createSequentialGroup()
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20)
                            .addComponent(painelProjetosBotalGerenciarServidores)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(51, 51, 51)
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(painelProjetosAlgoritmos)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                            .addComponent(jLabel21)))
                    .addGroup(painelProjetoLayout.createSequentialGroup()
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(painelProjetoBotaoAutomaticoManual)
                            .addGroup(painelProjetoLayout.createSequentialGroup()
                                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel22)
                                    .addComponent(jLabel23))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(painelProjetoCaixaNivel, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)
                                    .addComponent(painelProjetoCaixaAbertura, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)))
                            .addGroup(painelProjetoLayout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addComponent(jToggleButton2)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel24))))
                .addContainerGap())
        );
        painelProjetoLayout.setVerticalGroup(
            painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelProjetoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(painelProjetoNomeProjeto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(painelProjetoAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(painelProjetoDataCriacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(painelProjetoLayout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(painelProjetoLayout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(painelProjetosBotalGerenciarServidores)
                    .addComponent(painelProjetosAlgoritmos))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, painelProjetoLayout.createSequentialGroup()
                        .addComponent(painelProjetoBotaoAutomaticoManual)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel22)
                            .addComponent(painelProjetoCaixaAbertura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(painelProjetoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(painelProjetoCaixaNivel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel23))
                        .addGap(18, 18, 18)
                        .addComponent(jToggleButton2))
                    .addGroup(painelProjetoLayout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        painelPrincipal.add(painelProjeto, "card9");

        scrollAlgoritmos.setViewportView(arvoreAlgoritmos);

        bacoPainelTabulado.addTab("Algoritmos", scrollAlgoritmos);

        arvoreProjetos.setSelectionModel(null);
        arvoreProjetos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                arvoreProjetosMouseClicked(evt);
            }
        });
        scrollProjetos.setViewportView(arvoreProjetos);

        bacoPainelTabulado.addTab("Projetos", scrollProjetos);

        scrollArvoresServidores.setViewportView(arvoreServidores);

        bacoPainelTabulado.addTab("Servidores", scrollArvoresServidores);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(bacoPainelTabulado, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(painelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(bacoPainelTabulado, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        jMenuBar1.setBackground(new java.awt.Color(204, 204, 255));
        jMenuBar1.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(102, 102, 255)));
        jMenuBar1.setForeground(new java.awt.Color(240, 250, 250));

        jMenu1.setBackground(new java.awt.Color(255, 102, 102));
        jMenu1.setText("Arquivo");
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });

        itemMenuCriarProjeto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        itemMenuCriarProjeto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/Configuration Settings_25_25.png"))); // NOI18N
        itemMenuCriarProjeto.setText("Criar Novo Projeto");
        itemMenuCriarProjeto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                itemMenuCriarProjetoMouseClicked(evt);
            }
        });
        itemMenuCriarProjeto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemMenuCriarProjetoActionPerformed(evt);
            }
        });
        jMenu1.add(itemMenuCriarProjeto);

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/easymoblog.png"))); // NOI18N
        jMenuItem3.setText("Alterar Projeto");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);
        jMenu1.add(jSeparator1);

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/katuberling.png"))); // NOI18N
        jMenuItem4.setText("Fechar");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuBar1.add(jMenu1);

        jMenu4.setText("Servidor OPC");
        jMenu4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu4ActionPerformed(evt);
            }
        });

        itemMenuCadastrarServidor.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        itemMenuCadastrarServidor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/Configuration Settings_25_25.png"))); // NOI18N
        itemMenuCadastrarServidor.setText("Cadastrar Servidor OPC");
        itemMenuCadastrarServidor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemMenuCadastrarServidorActionPerformed(evt);
            }
        });
        jMenu4.add(itemMenuCadastrarServidor);

        jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/button_cance25_25l.png"))); // NOI18N
        jMenuItem6.setText("Excluir Servidor OPC");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem6);

        jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/easymoblog.png"))); // NOI18N
        jMenuItem7.setText("Alterar Servidor OPC ");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem7);

        jMenuItem10.setText("teste");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem10);

        jMenuBar1.add(jMenu4);

        jMenu2.setText("Algoritmos");

        itemMenuCadastrarAlgoritmo.setText("Cadastrar Algoritmo");
        itemMenuCadastrarAlgoritmo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemMenuCadastrarAlgoritmoActionPerformed(evt);
            }
        });
        jMenu2.add(itemMenuCadastrarAlgoritmo);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Help");
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bacoopc/gui/Help44.png"))); // NOI18N
        jMenuItem8.setText("Aljuda");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem8);
        jMenu3.add(jSeparator2);
        jMenu3.add(jSeparator4);

        jMenuItem9.setText("Créditos");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem9);

        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void itemMenuCriarProjetoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_itemMenuCriarProjetoMouseClicked
        // TODO add your handling code here:
}//GEN-LAST:event_itemMenuCriarProjetoMouseClicked

    private void itemMenuCriarProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemMenuCriarProjetoActionPerformed
        this.mostrarPainelCadastrarProjetos();
}//GEN-LAST:event_itemMenuCriarProjetoActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        System.exit(0);

        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card7");
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void itemMenuCadastrarServidorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemMenuCadastrarServidorActionPerformed

        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card3");


        // jLabel1.setText("Nome do Servidor:");


        // TODO add your handling code here:
    }//GEN-LAST:event_itemMenuCadastrarServidorActionPerformed

    private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu4ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card6");
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card8");
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void servidorOpcNomeServidorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_servidorOpcNomeServidorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_servidorOpcNomeServidorActionPerformed

    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card5");// TODO add your handling code here:
    }//GEN-LAST:event_jMenu1ActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed

        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card4");// TODO add your handling code here:
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu3ActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card4");


        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card9");        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
        CardLayout x = (CardLayout) painelPrincipal.getLayout();
        x.show(painelPrincipal, "card10");        // TODO add your handling code here:

        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void cadastrarProjetoNomeProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarProjetoNomeProjetoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cadastrarProjetoNomeProjetoActionPerformed

    private void labelCriarNovoProjetoTelaInicialKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_labelCriarNovoProjetoTelaInicialKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_labelCriarNovoProjetoTelaInicialKeyReleased

    private void labelCriarNovoProjetoTelaInicialMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCriarNovoProjetoTelaInicialMouseReleased
        this.mostrarPainelCadastrarProjetos();
    }//GEN-LAST:event_labelCriarNovoProjetoTelaInicialMouseReleased

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        BacoOPC opc = BacoOPC.getInstance() ;
        try {
            opc.adicionarNovoProjeto( cadastrarProjetoNomeProjeto.getText(),
                    this.cadastrarProjetoNomeAutor.getText() ) ;
        } catch (ExcecaoBacoOpc ex) {
            Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.atualizarArvores();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void cadastrarProjetoNomeAutorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrarProjetoNomeAutorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cadastrarProjetoNomeAutorActionPerformed

    private void cadastroServidorOpcCriarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroServidorOpcCriarActionPerformed
        BacoOPC opc = BacoOPC.getInstance() ;
        try {
            opc.adicionarNovoServidorOpc( this.servidorOpcNomeServidor.getText() ,
                    this.servidorOpcUrl.getText() ) ;
        } catch (ExcecaoBacoOpc ex) {
            Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.atualizarArvores();
    }//GEN-LAST:event_cadastroServidorOpcCriarActionPerformed

    private void itemMenuCadastrarAlgoritmoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemMenuCadastrarAlgoritmoActionPerformed
        NovoAlgoritmo janelaNovoAlgoritmo = new NovoAlgoritmo(this, true) ;
        janelaNovoAlgoritmo.setVisible(true);
        AlgoritmoInterface alg = janelaNovoAlgoritmo.getAlgoritmo() ;
        if (alg != null) {

            BacoOPC.getInstance().adicionarNovoAlgoritmo(alg);
        }
        this.atualizarArvores();
    }//GEN-LAST:event_itemMenuCadastrarAlgoritmoActionPerformed

    private void arvoreProjetosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_arvoreProjetosMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_arvoreProjetosMouseClicked

    private void labelCadastrarServidorOpcTelaInicialMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCadastrarServidorOpcTelaInicialMouseReleased
        this.mostrarPainelCadastrarServidores();
    }//GEN-LAST:event_labelCadastrarServidorOpcTelaInicialMouseReleased

    private void labelCadastrraAlgoritmoTelaInicialMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCadastrraAlgoritmoTelaInicialMouseReleased
        this.mostrarPainelCadastrarAlgoritmo();
    }//GEN-LAST:event_labelCadastrraAlgoritmoTelaInicialMouseReleased

    private void painelProjetoNomeProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_painelProjetoNomeProjetoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_painelProjetoNomeProjetoActionPerformed

    private void painelProjetosAlgoritmosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_painelProjetosAlgoritmosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_painelProjetosAlgoritmosActionPerformed

    private void painelProjetosBotalGerenciarServidoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_painelProjetosBotalGerenciarServidoresActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_painelProjetosBotalGerenciarServidoresActionPerformed

    private void painelProjetoBotaoAutomaticoManualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_painelProjetoBotaoAutomaticoManualActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_painelProjetoBotaoAutomaticoManualActionPerformed

    private void jToggleButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jToggleButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTree arvoreAlgoritmos;
    private javax.swing.JTree arvoreProjetos;
    private javax.swing.JTree arvoreServidores;
    private javax.swing.JTabbedPane bacoPainelTabulado;
    private javax.swing.JTextField cadastrarProjetoNomeAutor;
    private javax.swing.JTextField cadastrarProjetoNomeProjeto;
    private javax.swing.JButton cadastroServidorOpcCriar;
    private javax.swing.JMenuItem itemMenuCadastrarAlgoritmo;
    private javax.swing.JMenuItem itemMenuCadastrarServidor;
    private javax.swing.JMenuItem itemMenuCriarProjeto;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JToggleButton jToggleButton2;
    private javax.swing.JLabel labelCadastrarServidorOpcTelaInicial;
    private javax.swing.JLabel labelCadastrraAlgoritmoTelaInicial;
    private javax.swing.JLabel labelCriarNovoProjetoTelaInicial;
    private javax.swing.JPanel painelPrincipal;
    private javax.swing.JPanel painelProjeto;
    private javax.swing.JTextField painelProjetoAutor;
    private javax.swing.JToggleButton painelProjetoBotaoAutomaticoManual;
    private javax.swing.JSpinner painelProjetoCaixaAbertura;
    private javax.swing.JTextArea painelProjetoCaixaLog;
    private javax.swing.JTextField painelProjetoCaixaNivel;
    private javax.swing.JTextField painelProjetoDataCriacao;
    private javax.swing.JList painelProjetoListaAlgoritmos;
    private javax.swing.JList painelProjetoListaServidores;
    private javax.swing.JTextField painelProjetoNomeProjeto;
    private javax.swing.JButton painelProjetosAlgoritmos;
    private javax.swing.JButton painelProjetosBotalGerenciarServidores;
    private javax.swing.JScrollPane scrollAlgoritmos;
    private javax.swing.JScrollPane scrollArvoresServidores;
    private javax.swing.JScrollPane scrollProjetos;
    private javax.swing.JTextField servidorOpcNomeServidor;
    private javax.swing.JTextField servidorOpcUrl;
    // End of variables declaration//GEN-END:variables
    private teste1 teste1;
    private teste2 teste2;
    private javax.swing.JPanel painelTeste;

    /**
 *
 * @author CrisGC
 */
protected class OuvinteArvoreProjetos implements TreeSelectionListener {

    /** Guarda a referência à interface gráfica */
    private GUI interfaceUtilizada ;

    /**
     *
     *
     * @param arg0
     */
    public void valueChanged(TreeSelectionEvent arg0) {

        Logger.getLogger("log:crisgc").entering(OuvinteArvoreProjetos.class.getName(), "valueChanged");
        // Avisa à interface que o nó foi selecionado
        Object selecao = this.interfaceUtilizada.getSelecao() ;
        interfaceUtilizada.mostrarPainel(selecao);
    }

}
}
